package com.tt.lcd.qunyangGPRS.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;

import com.tt.lcd.qunyangGPRS.R;
import com.tt.lcd.qunyangGPRS.dao.DataManager;

import java.util.HashMap;
import java.util.List;

public class Dantai_info extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dantai_info);
		ListView listView = (ListView) this.findViewById(R.id.dantai_list);


		Intent it = getIntent();

		String zhanID = it.getExtras().getString("zhanId");
		String date = it.getExtras().getString("date");

		//获取到集合数据
		List<HashMap<String, Object>> data = new DataManager(this).getPigInfo(zhanID,date);
		SimpleAdapter adapter = new SimpleAdapter(this, data, R.layout.dantai_list,
				new String[]{"erbiao", "ycaisi","yicaisi","weiwan"}, new int[]{R.id.pig_id, R.id.jihua,R.id.jinsi,R.id.weiwan});
		//实现列表的显示
		listView.setAdapter(adapter);


//		List<HashMap<String, Object>> data = new ArrayList<HashMap<String, Object>>();
//		Intent it =getIntent();
//		String date = it.getExtras().getString("zhanId");
//
//		if(date.equals("11")){
//			HashMap<String, Object> item = new HashMap<String, Object>();
//			item.put("erbiao", "900000011200396");
//			item.put("ycaisi", "2200");
//			item.put("yicaisi", "1400");
//			item.put("weiwan", "800");
//			data.add(item);
//			HashMap<String, Object> item2 = new HashMap<String, Object>();
//			item2.put("erbiao", "900000011200470");
//			item2.put("ycaisi", "2500");
//			item2.put("yicaisi", "800");
//			item2.put("weiwan", "1700");
//			data.add(item2);
//		}else if(date.equals("23")){
//			HashMap<String, Object> item = new HashMap<String, Object>();
//			item.put("erbiao", "900000011200440");
//			item.put("ycaisi", "2200");
//			item.put("yicaisi", "1600");
//			item.put("weiwan", "600");
//			data.add(item);
//		}else if(date.equals("14")){
//			HashMap<String, Object> item = new HashMap<String, Object>();
//			item.put("erbiao", "900000011200277");
//			item.put("ycaisi", "2500");
//			item.put("yicaisi", "1400");
//			item.put("weiwan", "1100");
//			data.add(item);
//		}
//
//
//
//
//
//       //创建SimpleAdapter适配器将数据绑定到item显示控件上
//       SimpleAdapter adapter = new SimpleAdapter(this, data, R.layout.dantai_list,
//                new String[]{"erbiao", "ycaisi","yicaisi","weiwan"}, new int[]{R.id.pig_id, R.id.jihua,R.id.jinsi,R.id.weiwan});
//       //实现列表的显示
//       listView.setAdapter(adapter);    
	}


}
